/*************************************************************************
	> File Name: p1443.cpp
	> Author: zhangxu 
	> Mail: walrus1983@126.com
	> Created Time: 五  8/30 14:34:18 2024
 ************************************************************************/

#include <cstdio>
using namespace std;
#define MAX_N 400

int n, m;
int dir[8][2] = {{ 2,  1},
 				 { 1,  2},
  				 {-1, -2},
				 {-2, -1},
				 { 1, -2},
				 {-1,  2},
				 {-2,  1},
				 { 2, -1}
  };
int dis[MAX_N + 5][MAX_N + 5];

void dfs(int step, int x, int y) {
	if(dis[x][y] != -1 && dis[x][y] < step) return ;
	dis[x][y] = step;
	for(int k = 0; k < 8; k++) {
		int dx = x + dir[k][0];
		int dy = y + dir[k][1];
		if(dx < 1 || dx > n) continue ;
		if(dy < 1 || dy > m) continue ;
		dfs(step + 1, dx, dy);
	}
	return ;
}

int main() {
	int x, y;
	scanf("%d%d%d%d", &n, &m, &x, &y);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			dis[i][j] = -1;
		}
	}
	dfs(0, x, y);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(j > 1) printf(" ");
			printf("%d", dis[i][j]);
		}
		printf("\n");
	}
	return 0;
}